<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Package admin</title>
	<link type="text/css" rel="stylesheet" href="css/dth.css" />
	<style>
.menu7 {
	box-shadow: 6px 11px 10px;
}

.admin_menu_package {
	background: #0FD1D1 !important;
}

.myTable td:nth-child(6) {
	width: 50px;
	text-align: center;
}
</style>
</h:head>

<h:body>
	<p:ajaxStatus
		style="bottom: 68%;
	    height: 32px;
	    position: fixed;
	    right: 50%;
	    width: 32px;
	    z-index: 99999;">
		<f:facet name="start">
			<p:graphicImage value="images/loading.gif" />
		</f:facet>

		<f:facet name="complete">
			<h:outputText value="" />
		</f:facet>
	</p:ajaxStatus>
	<p:growl id="growl" showDetail="true" sticky="false" />
	<ui:insert name="header">
		<ui:include src="/header/header_dth.xhtml" />
	</ui:insert>
	<div>
		<div class="dth_body_home">
			<ui:insert name="header_banner">
				<ui:include src="/header/header_banner.xhtml" />
			</ui:insert>
			<div class="dth_content">
				<div class="dth_admin_menu">
					<h:form>
						<ui:insert name="header_banner">
							<ui:include src="/header/menu_admin.xhtml" />
						</ui:insert>

					</h:form>
				</div>
				<div class="dth_content_admin">
					<div class="menu_top1">
						<h:form id="dlgform">
							<p:dialog header="#{msg['header_insert']} #{msg['menu_admin_package']}" widgetVar="dlg" id="dlg"
								width="600" height="430" resizable="false">
								<h:panelGroup id="dlgisert">
									<h:inputHidden value="#{packageBean.id}"></h:inputHidden>
									<h:inputHidden value="#{packageBean.fkAdminId}"></h:inputHidden>
									<div class="feild-input">
										<h:outputLabel value="#{msg['name']}"></h:outputLabel>
										<h:inputText value="#{packageBean.name}"></h:inputText>
									</div>
									<div class="feild-input">
										<h:outputLabel value="#{msg['price']}"></h:outputLabel>
										<h:inputText value="#{packageBean.price}" style="width:200px;"></h:inputText>
									</div>
									<div class="feild-input">
										<h:outputLabel value="#{msg['description']}"></h:outputLabel>
										<p:editor value="#{packageBean.description}" width="400"
											height="275" style="float:left;">
										</p:editor>
									</div>
									<div class="feild-action">
										<p:commandButton value="#{msg['btn_ok']}" oncomplete="dlg.hide()"
											action="#{packageBean.insert}" update=":mainform,:growl"></p:commandButton>
										<p:commandButton value="#{msg['btn_cancel']}" oncomplete="dlg.hide()"></p:commandButton>
									</div>
								</h:panelGroup>

							</p:dialog>
						</h:form>
						<h:form id="form_confirm_delete_package">
							<p:confirmDialog id="confirm_delete_package"
								message="#{msg['delete_mess']}" header="#{msg['btn_delete']} #{msg['menu_admin_package']}"
								width="400" showEffect="clip" closable="false"
								widgetVar="confirm_del_package">
								<h:panelGroup id="data">
									<h:inputHidden value="#{packageBean.id}"></h:inputHidden>
									<div class="feild-action">
										<p:commandButton value="#{msg['btn_yes']}" action="#{packageBean.delete()}"
											onclick="confirm_del_package.hide()"
											update=":mainform,:growl"></p:commandButton>
										<p:commandButton value="#{msg['btn_no']}"
											onclick="confirm_del_package.hide()"></p:commandButton>
									</div>
								</h:panelGroup>


							</p:confirmDialog>
						</h:form>
						<h:form>
							<p:commandButton onclick="dlg.show()" title="#{msg['btn_insert']}"
								icon="ui-icon ui-icon-plusthick" update=":dlgform:dlgisert"></p:commandButton>
							<h:outputText value="Package"
								style="margin-left:5px;font-size: 20px;font-weight: bold;"></h:outputText>
						</h:form>
					</div>
					<div class="dth_admin_main">
						<h:panelGroup id="mainform">
							<h:form>
								<p:dataTable var="item" paginator="true" rows="15"
									styleClass="myTable" paginatorPosition="bottom"
									paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
									value="#{packageBean.listPackage}" rowIndexVar="row">
									<p:column headerText="Stt">
										<h:outputText value="#{row+1}" />
									</p:column>
									<p:column headerText="#{msg['name']}">
										<h:outputText style="float:left;" value="#{item.name}">
										</h:outputText>
									</p:column>
									<p:column headerText="#{msg['price']}">
										<h:outputText style="float:left;" value="#{item.priceStr}">
										</h:outputText>
									</p:column>
									<p:column headerText="#{msg['description']}">
										<h:outputText style="float:left;" value="#{item.description}"  escape="false">
										</h:outputText>
									</p:column>
									<p:column headerText="#{msg['date_insert']}">
										<h:outputText style="float:left;" value="#{item.dateInsert}">
										</h:outputText>
									</p:column>
									<p:column headerText="#{msg['menu_action']}">
										<h:panelGroup>
											<p:commandLink onclick="confirm_del_package.show()"
												update=":form_confirm_delete_package:data">
												<f:param value="delete" name="action"></f:param>
												<f:param value="#{item.id}" name="package_id"></f:param>
												<img src="images/icon_delete.png" title="#{msg['btn_delete']}" />
											</p:commandLink>
											<p:commandLink onclick="dlg.show()"
												update=":dlgform:dlgisert">
												<f:param value="update" name="action"></f:param>
												<f:param value="#{item.id}" name="package_id"></f:param>
												<img src="images/icon_edit.png" title="#{msg['btn_delete']}" />
											</p:commandLink>

										</h:panelGroup>

									</p:column>
								</p:dataTable>
							</h:form>
						</h:panelGroup>
					</div>
				</div>
			</div>
		</div>
	</div>
	<ui:insert name="header">
		<ui:include src="/footer/footer_dth.xhtml" />
	</ui:insert>

</h:body>
</html>